package com.hxit.contorller;

import com.hxit.pojo.Conversation;
import com.hxit.pojo.Result;
import com.hxit.servics.ConversationsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
public class ConversationsController {
    @Autowired
    private ConversationsService conversationService;

    //新增Conversation方法
    @PostMapping("/AddConversations")
    public Result AddConversations(@RequestBody Conversation conversation){
        log.info("新增conversation");
        conversationService.AddConversations(conversation);
        return Result.success();
    }
    //删除Conversations方法
    @DeleteMapping("/DeleteConversationsById/{ids}")
    public Result DeleteConversationsById(@PathVariable List<Integer> ids) {
        log.info("删除conversation");
        conversationService.DeleteConversationsById(ids);
        return Result.success();
    }
    //修改日志信息
    @PutMapping("/updateConversations")
    public Result updateConversations(@RequestBody Conversation conversation){
        conversationService.UpdateConversations(conversation);
        log.info("修改日志");
        return Result.success();
    }
    //根据id查询模型信息方法
    @GetMapping("/FindConversationById")
    public  Result FindConversationById(@RequestParam("id") Integer id){
        log.info("根0");
        Conversation conversation=conversationService.FindConversationById(id);
        return Result.success(conversation);
    }

}